Hello.
In this lecture are we going to create the functionality for our projet using javascript to save time.
I have already had the javascript to our javascript file are just wrong.
True they could with you on line one.
I've created a variable chord name and I've set it to each quarter to prompt the prompt.
Is he have a script method that displays a prompt box where it prompt you to enter something.
So in that prompt I have specified what I want the prompt to do so you should say enter your name please
and then inside the prompt you have the variable name.
So this here is where you change.
So when you click on the page it should have this name so you need to change that and insert your name.
If not he extended greeting to this value code name.
So line 1 is just to claim the variable name and set in it took a course to prompt.
So Line 1 will enable the prompt which is a method.
It will display the dialogue box with this message.
Inside is parentheses line to create a variable called today and I've set it to equal to date object.
So if you want to create a you can use the new Date object we we've created a object here using the
new date date object lets you work with dates which includes years month days hours minutes seconds
and merely seconds on line 3.
I have created a variable called powers and I've set it to a few to to day don't get ours the get powers
method is used to return the hour up cording to the local time on your computer.
So day to day here today is referencing the variable today so it is variable.
Hours equals four days variable Don't forget ours method which will return the powers up calling to
the local time on your computer.
So once variable here gets the hours from the computer line for here to display that on the screen is
in the document.
Don't write in write line document.
Don't write a line here.
Okay so what it does it will display the time it will display this and then in break look past the break.
This is a break tag.
You create a space and then on the other line it will create this right.
This statement then creates a break.
Okay so this is what this function will do.
Each tool used this document the right line basically is it'll create a line after each statement.
That's what that is okay.
Document derived line is a javascript method that is similar to the document or to write.
The only difference is that heat adds a new line character after the statement right in the document
right.
Method is mostly use.
Notice here my 7 document or write method that is mostly used for testing purposes you must never use
it in a production environment because if it is used half his thier email isn't fully loaded it would
delete all the existing hastier mail.
So never use it in the production environment.
This is only for testing purposes.
Okay document or write.
Should really be used in production right.
So what did document right method.
Does it all just write a line on it.
What is bisley use to write a text.
So what people do is to write this text.
Good morning plus whatever name is entered the name.
Here is a name we're talking about here.
If my name is Joe Bloggs say good morning Joe Bloggs plots in I will give dinners I mention Mark.
Okay so what is code is same on line 6.
Hmm.
If statement it's saying that if the hours notice we've got a variable called hours on line 3 if the
hours is less down or equals to 12 then write this statement on the screen.
Good morning.
Plus the name of the person the name the person entered in line one.
Okay you say good morning.
Plus that plus the explanation or else the hours is less than or equal to 18 hours.
Then write this statement document right.
Good afternoon.
Plus the name of the person in this claymation.
All right.
Else you write document.
All right.
Good evening.
Plus the name of the person and then document or writing you create.
That means you create it.
Break the document.
All right.
I mean he has an extra line underneath it.
All right so in a nutshell the statement is used to check the conditions the hours is less some equal
say 12.
It would display a message saying good morning.
Plus the name of the person that's a name that was entered in line one if the hours is less than year
close to 18.
It'll display Good afternoon to name or else it'll display.
Good evening.
Plus to name.
All right.
So d document or write line undocument or write are similar documents.
All right.
Basically is used to write text on the screen while the document done right.
It's the same but the difference is that it adds a new line character after each statement.
Please do not use the document right or rifling in the production environment.
This is only for testing because if you use this once you're hastier mila's it will delete all your
hasty email.
Very important.
Only used is for testing only.
So that's it.
So let me say this and then we can test.
All right so this is hard direct crime.
I just need to click on that.
We should have a prompt So this is the prompt.
So I just need to change that variable and tie I'm just so you don't move for example and call.
Okay.
And you should see.
Good evening you dimi it detected from my clock on my computer that isn't even in here.
That's it.
That's obvious.
It detects the time from your computer and displays a message based on the negative For example if you
type team.
Then what are you typed in Peter.
We'll see.
Good evening Peter.
Depending on the time where you are.
So that's it.
Thanks for watching.
Bye for now.